package com.z3n.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Set;


/**
 * The persistent class for the Z3N_USERS database table.
 * 
 */
@Entity
@Table(name="Z3N_USERS")
@NamedQueries({@NamedQuery(name = "getZ3nUserByUserPassword", query = "SELECT z FROM Z3nUser z WHERE z.userPassword = :userPassword"),@NamedQuery(name = "getZ3nUserByUserName", query = "SELECT z FROM Z3nUser z WHERE z.userName = :userName"),
@NamedQuery(name = "getZ3nUserByUserEmail", query = "SELECT z FROM Z3nUser z WHERE z.userEmail = :userEmail"),
@NamedQuery(name = "getZ3nUserByUserAddress", query = "SELECT z FROM Z3nUser z WHERE z.userAddress = :userAddress"),
@NamedQuery(name = "getZ3nUserByUserActivitationurl", query = "SELECT z FROM Z3nUser z WHERE z.userActivitationurl = :userActivitationurl"),
@NamedQuery(name = "getZ3nUserByUserId", query = "SELECT z FROM Z3nUser z WHERE z.userId = :userId")})
public class Z3nUser implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="USER_ID")
	private int userId;

	@Column(name="USER_ACTIVITATIONURL")
	private String userActivitationurl;

	@Column(name="USER_ADDRESS")
	private String userAddress;

	@Column(name="USER_EMAIL")
	private String userEmail;

	@Column(name="USER_NAME")
	private String userName;

	@Column(name="USER_PASSWORD")
	private String userPassword;

	//bi-directional many-to-one association to Z3nGroupsUser
	@OneToMany(mappedBy="z3nUser")
	private Set<Z3nGroupsUser> z3nGroupsUsers;

	//bi-directional many-to-one association to Z3nRelationship
	@OneToMany(mappedBy="z3nUser1")
	private Set<Z3nRelationship> z3nRelationships1;

	//bi-directional many-to-one association to Z3nRelationship
	@OneToMany(mappedBy="z3nUser2")
	private Set<Z3nRelationship> z3nRelationships2;

    public Z3nUser() {
    }

	public int getUserId() {
		return this.userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getUserActivitationurl() {
		return this.userActivitationurl;
	}

	public void setUserActivitationurl(String userActivitationurl) {
		this.userActivitationurl = userActivitationurl;
	}

	public String getUserAddress() {
		return this.userAddress;
	}

	public void setUserAddress(String userAddress) {
		this.userAddress = userAddress;
	}

	public String getUserEmail() {
		return this.userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPassword() {
		return this.userPassword;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public Set<Z3nGroupsUser> getZ3nGroupsUsers() {
		return this.z3nGroupsUsers;
	}

	public void setZ3nGroupsUsers(Set<Z3nGroupsUser> z3nGroupsUsers) {
		this.z3nGroupsUsers = z3nGroupsUsers;
	}
	
	public Set<Z3nRelationship> getZ3nRelationships1() {
		return this.z3nRelationships1;
	}

	public void setZ3nRelationships1(Set<Z3nRelationship> z3nRelationships1) {
		this.z3nRelationships1 = z3nRelationships1;
	}
	
	public Set<Z3nRelationship> getZ3nRelationships2() {
		return this.z3nRelationships2;
	}

	public void setZ3nRelationships2(Set<Z3nRelationship> z3nRelationships2) {
		this.z3nRelationships2 = z3nRelationships2;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + userId;
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Z3nUser)) {
			return false;
		}
		Z3nUser other = (Z3nUser) obj;
		if (userId != other.userId) {
			return false;
		}
		return true;
	}
	
}